package com.ruoyi.zyx.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zyx.mapper.ZyxRecordMapper;
import com.ruoyi.zyx.domain.ZyxRecord;
import com.ruoyi.zyx.service.IZyxRecordService;

/**
 * 设备档案信息Service业务层处理
 *
 * @author lhs
 * @date 2021-06-08
 */
@Service
public class ZyxRecordServiceImpl implements IZyxRecordService
{
    @Autowired
    private ZyxRecordMapper zyxRecordMapper;

    /**
     * 查询设备档案信息
     *
     * @param id 设备档案信息ID
     * @return 设备档案信息
     */
    @Override
    public ZyxRecord selectZyxRecordById(Long id)
    {
        return zyxRecordMapper.selectZyxRecordById(id);
    }

    @Override
    public int delByDeviceId(Long deviceid) {
        return zyxRecordMapper.delByDeviceId(deviceid);
    }

    /**
     * 查询设备档案信息列表
     *
     * @param zyxRecord 设备档案信息
     * @return 设备档案信息
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "")
    public List<ZyxRecord> selectZyxRecordList(ZyxRecord zyxRecord)
    {
        return zyxRecordMapper.selectZyxRecordList(zyxRecord);
    }

    /**
     * 新增设备档案信息
     *
     * @param zyxRecord 设备档案信息
     * @return 结果
     */
    @Override
    public int insertZyxRecord(ZyxRecord zyxRecord)
    {
        zyxRecord.setCreateTime(DateUtils.getNowDate());
        return zyxRecordMapper.insertZyxRecord(zyxRecord);
    }

    /**
     * 修改设备档案信息
     *
     * @param zyxRecord 设备档案信息
     * @return 结果
     */
    @Override
    public int updateZyxRecord(ZyxRecord zyxRecord)
    {
        zyxRecord.setUpdateTime(DateUtils.getNowDate());
        return zyxRecordMapper.updateZyxRecord(zyxRecord);
    }

    /**
     * 批量删除设备档案信息
     *
     * @param ids 需要删除的设备档案信息ID
     * @return 结果
     */
    @Override
    public int deleteZyxRecordByIds(Long[] ids)
    {
        return zyxRecordMapper.deleteZyxRecordByIds(ids);
    }

    /**
     * 删除设备档案信息信息
     *
     * @param id 设备档案信息ID
     * @return 结果
     */
    @Override
    public int deleteZyxRecordById(Long id)
    {
        return zyxRecordMapper.deleteZyxRecordById(id);
    }
}
